﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Globalization;

namespace BT_web__nhom06.BiThuChiDoan
{
    public partial class ThongTinHoatDongDoan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string mahoatdong = Request.QueryString["id"];
                if (mahoatdong != null)
                {
                    DataTable tbl = Tienichsql.ketnoicsdl.ChayLenhSelectDuLieu("SELECT * FROM hoatdongdoan where mahoatdong=@mahoatdong", "@mahoatdong", mahoatdong);
                    if (tbl.Rows.Count > 0)
                    {
                        DataRow dr = tbl.Rows[0];
                        lbtenhoatdong.Text = (string)dr["tenhoatdong"];
                        lbmota.Text = (string)dr["mota"];
                        if (dr.IsNull("tgbatdau") == false)
                            lbthoigianbatdau.Text = ((DateTime)dr["tgbatdau"]).ToString("dd/MM/yyyy");
                        else
                            lbthoigianbatdau.Text = "";
                        if (dr.IsNull("tgketthuc") == false)
                            lbthoigianketthuc.Text = ((DateTime)dr["tgketthuc"]).ToString("dd/MM/yyyy");
                        else
                            lbthoigianketthuc.Text = "";
                        lbdiadiem.Text = (string)dr["diadiem"];
                        lbnguoiphutrach.Text = (string)dr["hotennguoiphutrach"];
                        lbdienthoai.Text = (string)dr["sodtnguoiphutrach"];
                        string tinhtrang = (string)dr["tinhtrang"];
                        if (tinhtrang == "0")
                        {
                            lbtinhtrang.Text = "Đã hoàn thành";
                        }
                        else
                        {
                            lbtinhtrang.Text = "Đang hoàn thành";
                        }
                    }

                }
                else
                    Response.Redirect("DShoatdongdoan.aspx");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("QL_hoatdongdoan.aspx");
        }
    }
}